<template>
  <div>
    <div>
      <div class="table_container">
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column label="序号" align="center">
            <template #default="scope">
              <span>{{ scope.$index + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="ts_code" label="代码" align="center">
          </el-table-column>
          <el-table-column prop="trade_date" label="交易日期" align="center">
          </el-table-column>
          <el-table-column
            prop="close"
            label="收盘价"
            align="center"
          ></el-table-column>
          <el-table-column prop="low" label="最低价" align="center">
          </el-table-column>
          <el-table-column prop="ma10" label="10均价" align="center">
            <template #default="scope">
              <span>{{ scope.row.ma10.toFixed(2) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="ma250" label="250均价" align="center">
            <template #default="scope">
              <span>{{ scope.row.ma250.toFixed(2) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="buy" label="买入价" align="center">
          </el-table-column>
          <el-table-column prop="width" label="宽度" align="center">
            <template #default="scope">
              <span>{{ scope.row.width.toFixed(2) }}</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>
import { getShareSelected } from "@/apis/share";
import { ref, onMounted, getCurrentInstance } from "vue";

export default {
  name: "shareSelect",
  setup() {
    const { proxy } = getCurrentInstance();
    let tableData = ref();
    let getSelectedShare = () => {
      getShareSelected()
        .then(res => {
          tableData.value = res.data;
          console.log(res.data);
        })
        .catch(err => {
          proxy.$message.error(err);
        });
    };

    onMounted(() => {
      getSelectedShare();
    });
    return {
      tableData
    };
  }
};
</script>

<style scoped>
.fillContainer {
  width: 100%;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
}

a {
  text-decoration: none;
}
/*正常的未被访问过的链接*/
a:link {
  text-decoration: none;
}
/*已经访问过的链接*/
a:visited {
  text-decoration: none;
}
/*鼠标划过(停留)的链接*/
a:hover {
  text-decoration: none;
}
/* 正在点击的链接*/
a:active {
  text-decoration: none;
}
</style>
